Template-based method and system for reverse engineering

ABSTRACT

A component-based source code associated with a software system is provided. The purpose is to extract its abstract representation. This abstract representation consists of the business logic of the source code and its infrastructure code. First, the source code is analyzed structurally. This produces a set of structural meta-data. These meta-data enable the extraction of the business logic of the source code. Then all concrete instances of the structural meta-data are replaced with context variables, which reference the business logic, allowing discovery of repetitive and nearly repetitive portions of source code which constitute the infrastructure code. Finally, the abstract representation obtained from the source code can be used for a reengineering step, which may consist of changes in the business logic and/or in the infrastructure code. The advantages are ensuring traceability between source code and its abstract representation filtered by a set of pre-existing generation templates, deriving the business logic of the source code and its generation templates and updating the business logic of the source code and its generation templates.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] The application claims priority of U.S. provisional patent application No. 60/330,442 filed Oct. 26, 2001.

FIELD OF THE INVENTION

[0002] The present invention is directed toward a template-based system and method for reverse engineering source code of a component-based application. More particularly, the present invention is directed to a system and method in which the system performs a post-development analysis on an existing component-based application. It analyzes a component-based application and creates its representation at higher abstraction level. This abstract information facilitates the comprehension and evolution of existing object-oriented applications.

TERMS

[0003] For the purpose of the present invention, the following terms are defined:

[0004] Software system: An application to be developed.

[0005] Software model: An abstraction of a software system.

[0006] Model element: An atomic constituent of a software model. A model element has relationships with other model elements and a set of property values. An example of a model element is a component or a class called “Customer,” which represents all customers managed by a developed software application with predefined attributes representing unique characteristics like first name, last name, birth date, etc.

[0007] Model element type: One of the valid types of model elements to be found within a software model. The model element type determines the role, valid relationships with other model elements, and properties of a model element. Examples of model element types are class, attribute, state, package, association, etc.

[0008] Stereotype: A designator, textual and graphical, for a model element denoting its role within the software model and, optionally, implying additional properties associated with the model element.

[0009] Property: A property is a characteristic of all model elements of a given model element type. A property has a name and content. Each model element of a type has content for each of the properties associated with its corresponding model element type. A property can be used to capture a non-functional requirement like a design decision, an implementation decision, or a code-related option. In the UML™ 1.3 specification, a property is called a tagged value.

[0010] Architectural issues: Statements that cover the best practices for transforming or implementing the model elements of a software system. The word “statements” refers to the domain model itself or to any technology or platform involved in its implementation.

[0011] Design decision: Implementation data or decisions that provide a valid answer for an architecture issue.

[0012] Software technology: Any significant software used to implement directly or indirectly a domain software model. The kind of software technology—free, commercial, in-house offering, or other—is immaterial. It is sufficient to note that collaborating or competing technologies have different implementations and different issues guiding their correct use.

[0013] Architectural layer: a portion of a software system representing the industry domain or a selected software technology or operating system platform used to implement the domain software model. Layering permits the developers of a system to group architecture issues per industry domain, technology, or platform so that changes within one layer have little or no impact on the other layers.

[0014] Infrastructure code: Code found in a software system that complements the business logic code.

BACKGROUND OF THE INVENTION

[0015] Rather than designing an application from scratch, companies develop multi-tier applications based on framework solutions offering services like persistence, security, and transaction. A framework is an object-oriented abstraction that provides an extensible library of cooperating classes that make up a reusable design solution for a given problem domain. In essence, a framework offers a generic solution, and software engineers need to implement specialized code—acting as component-to-framework integration code—in each component in order to specify its special treatments when processed by the framework.

[0016] When a framework is customized or additional functionalities are implemented, changes are often required in the component-to-framework integration code for all participating components. Maintaining the integration code over the course of such changes is a tedious and error-prone process. Software engineers have to manually edit and modify the generated component-to-framework integration code in every component participating in a given framework because its associated code generator is rarely customizable so as to reflect company requirements implemented inside the framework. Most frameworks prevent a company from centralizing and capturing their corporate repository data because their associated code generators are rarely integrated with a modeling tool. With Codagen Architect and its generation templates (see international patent application PCT/CA99/00929 filed Oct. 12, 1999 by the Applicant), software engineers maintain the component-to-framework integration code by making the appropriate changes in the associated generation templates before generating the code from the model.

[0017] Moreover, corporations face mounting maintenance and reengineering costs for existing large applications. Evolving over several years, these applications embody substantial corporate knowledge, including requirements, business rules, and design decisions. Such knowledge, which can be considered an in-house framework, is difficult to recover after many years of operation, evolution, and turnover rate. To address this problem, software engineers are spending an increasing amount of effort to understand source code, commonly called program understanding. In fact, it has been estimated that fifty to ninety percent of evolution work is devoted to program comprehension or understanding (see T. A Standish. “An essay on software reuse.” IEEE Transactions on Software Engineering, Vol. 10, Num. 5, pp. 494-497, September 1984.) Hence, simplifying the understanding process can have significant economic savings.

[0018] One solution to program comprehension is to provide tools for facilitating source navigation. Examples of such tools are Sniff+ available from Wind River Systems and Source Navigator available from Free Software Foundation. These tools provide fast and intuitive source navigation and allow for the analysis of complex relationships within a large body of source code that may have thousands of files and over a million lines of code.

[0019] Another solution to the problem of program understanding is reverse engineering. Reverse engineering is the process of analyzing a subject system to (1) identify the system's components and their interrelationships and (2) create representations of the system in another form or a higher level of abstraction.

[0020] In the realm of component source code, several tools, such as Rational Rose, available from Rational and Together Control Center available from TogetherSoft, provide reverse engineering support. These tools allow one to get a higher representation of a component source code. This representation is usually a static structure of the source described as a class diagram, which shows a set of classes and interfaces and their relationships. Note that some systems, such as the system described by Graham in U.S. Pat. No. 6,199,198 and Together Control Center, also allow one to get a dynamic representation of source code expressed as object interaction diagrams. These diagrams show the messages exchanged by the different components included in the source code.

[0021] However, the higher abstraction representation of source code allowed by these approaches provides not only the business logic of the system but also its underlying infrastructure code for a given platform, which creates noise. It is believed that once a representation of source code grows beyond a certain size, its usefulness diminishes to the point where the cost of production and maintenance exceeds the benefit. It is therefore believed that it is futile to build a representation of source code that is very large. Hence, there is a need for distinguishing the business or core logic of the source code associated with a software system from some or all aspects of the infrastructure code.

SUMMARY OF THE INVENTION

[0022] Accordingly, it is an object of the present invention to provide a system that performs post-development analysis on existing component-based source code.

[0023] Another object of the present invention is to provide a system for deriving the abstract representation of component-based source code. This abstract representation can be a UML class diagram containing the necessary meta-data information from the domain logic structure and its implementation data as used in the infrastructure code and, separately, its infrastructure code.

[0024] Another object of the present invention is to provide a system for deriving an abstract representation of component-based source code that may be used for reengineering purposes.

[0025] According to one broad aspect of the present invention, there is provided a method of generating a higher-level representation of program source code, the method comprising: providing a program source code; parsing the program source code to obtain meta-data corresponding to the program source code; determining a business logic from at least the meta-data; translating the program source code into parameterized source code using at least one of the business logic and the meta-data; extracting infrastructure code from the parameterized source code using at least one of the source code and the meta-data; building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit generation of the program source code using the higher-level representation.

[0026] According to another broad aspect of the present invention, there is provided a method of program code reengineering comprising: providing a program source code; parsing the program source code to obtain meta-data corresponding to the program source code; determining a business logic from at least the meta-data; translating the program source code into parameterized source code using at least one of the business logic and the meta-data; extracting infrastructure code from the parameterized source code using at least one of the source code and the meta-data; building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit generation of the program source code using the higher-level representation; modifying at least a portion of the higher-level representation to effect a reengineering change in the program source code; and generating reengineered program source code using the modified higher-level representation.

[0027] According to still another broad aspect of the present invention, there is provided a method of generating a higher-level representation of program source code using a set of previously used generation template data, the method comprising: providing a program source code; providing a set of generation template data previously used to generate the program source code; selecting at least one of the set of generation template data; parsing the program source code to obtain meta-data corresponding to the program source code; determining a business logic from at least the meta-data; translating the program source code into parameterized source code using the set of generation template data and at least one of the business logic and the meta-data; extracting infrastructure code from the parameterized source code using the set of generation template data and at least one of the source code and the meta-data; building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit generation of the program source code using the higher-level representation.

[0028] According to a further broad aspect of the present invention, there is provided an apparatus for generating a higher-level representation of program source code comprising: a program source code provider for providing a program source code; a parser for parsing the program source code to obtain meta-data corresponding to the program source code; a business logic determiner for determining a business logic from at least the meta-data; a code translator for translating the program source code into parameterized source code using at least one of the business logic and the meta-data; an infrastructure extractor for extracting infrastructure code from the parameterized source code using at least one of the source code and the meta-data; an abstraction builder for building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit to a code generator to generate the program source code using the higher-level representation.

[0029] According to another broad aspect of the present invention, there is provided an apparatus for reengineering program code comprising: a program source code provider for providing a program source code; a parser for parsing the program source code to obtain meta-data corresponding to the program source code; a business logic determiner for determining a business logic from at least the meta-data; a code translator for translating the program source code into parameterized source code using at least one of the business logic and the meta-data; an infrastructure extractor for extracting infrastructure code from the parameterized source code using at least one of the source code and the meta-data; an abstraction builder for building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit to a code generator to generate the program source code using the higher-level representation; a reengineering modifier for modifying at least a portion of the higher-level representation to effect a reengineering change in the program source code; and a code generator for generating reengineered program source code using the modified higher-level representation.

[0030] According to a further broad aspect of the present invention, there is provided an apparatus for generating a higher-level representation of program source code using a set of previously used generation template data, the apparatus comprising: a program source code provider for providing a program source code; template provider for providing a set of generation template data previously used to generate the program source code; template selector for selecting at least one of the set of generation template data; a parser for parsing the program source code to obtain meta-data corresponding to the program source code; a business logic determiner for determining a business logic from at least the meta-data; a code translator for translating the program source code into parameterized source code using the set of generation template data and at least one of the business logic and the meta-data; an infrastructure extractor for extracting infrastructure code from the parameterized source code using the set of generation template data and at least one of the source code and the meta-data; an abstraction builder for building the higher-level representation of the source code using the business logic and the infrastructure code, wherein the higher-level representation provides sufficient information about the source code to permit to a code generator to generate the program source code using the higher-level representation.

[0031] A component-based source code associated with a software system is provided. The purpose is to extract its abstract representation. This abstract representation consists of the business logic of the source code and its infrastructure code. First, the source code is analyzed structurally. This produces a set of structural meta-data. These meta-data enable the extraction of the business logic of the source code. Then all concrete instances of the structural meta-data are replaced with context variables, which reference the business logic, allowing discovery of repetitive and nearly repetitive portions of source code which constitute the infrastructure code. Finally, the abstract representation obtained from the source code can be used for a reengineering step, which may consist of changes in the business logic and/or in the infrastructure code. The advantages are ensuring traceability between source code and its abstract representation filtered by a set of pre-existing generation templates, deriving the business logic of the source code and its generation templates and updating the business logic of the source code and its generation templates.

[0032] Let sourceCode1 be component-based source code and higherRep1 be its higher abstraction representation. Assuming that sourceCode1 has evolved to sourceCode2, the purpose of (1) is to report the delta code (the difference between sourceCode1 and sourceCode2) in order to update higherRep1 by filtering the source code with a library of transformation rules (generation templates). SourceCode1 and higherRep1 could be empty.

[0033] Let sourceCode be component-based source code. The purpose of (2) is to extract the higher abstraction representation of sourceCode and a set of generation templates, which capture transformation decisions and repetitive and nearly repetitive portions of sourceCode.

[0034] Let sourceCode1 be component-based source code, businessLogic be its business logic, and projGen a library of generation templates used to generate sourceCode1 from businessLogic. Assuming that sourceCode1 has evolved to sourceCode2, the purpose of (3) is to update businessLogic and projGen in order to reflect the evolution of sourceCode1 to sourceCode2.

BRIEF DESCRIPTION OF THE FIGURES

[0035] Having thus generally described the nature of the invention, reference will now be made to the accompanying figures, showing by way of illustration a preferred embodiment thereof, and in which

[0036]FIG. 1 shows the generic process for reverse engineering and reengineering of component source code;

[0037]FIG. 2 shows the process for ensuring consistency between source code and its higher abstraction representation;

[0038]FIG. 3 describes a higher abstraction representation of a ‘Bank’ system;

[0039]FIG. 4 shows a set of generation templates;

[0040]FIG. 5 shows the detail of the generation template ‘model class’;

[0041]FIG. 6 shows the detail of the generation template ‘model attributes’;

[0042]FIG. 7 shows the detail of the generation template ‘association card max=1’;

[0043]FIG. 8 shows the detail of the generation template ‘association card max=N’;

[0044]FIG. 9 shows the detail of the generation template ‘get selector’;

[0045]FIG. 10 shows the detail of the generation template ‘set selector’;

[0046]FIG. 11 shows the detail of the generation template ‘add elements of associations card max=N’;

[0047]FIG. 12 shows the detail of the generation template ‘remove elements of associations card max=N’;

[0048]FIG. 13 shows the new version of the higher abstraction representation of the ‘Bank system’ after application of the process to the evolved source code;

[0049]FIG. 14 shows the process for extracting the business logic and generation templates of component source code;

[0050]FIG. 15 shows the sub-steps for extracting the business logic of component source code;

[0051]FIG. 16 presents the results of extracting the business logic of the Bank system described in FIGS. 38-58;

[0052]FIG. 17 describes the sub-steps for creating class and interface templates;

[0053]FIG. 18 describes the sub-steps for creating attribute templates;

[0054]FIG. 19 describes the sub-steps for creating method templates;

[0055]FIG. 20 describes the sub-steps for updating the business logic and generation templates from evolved source code;

[0056]FIG. 21 describes the sub-steps for updating the business logic from evolved source code;

[0057]FIG. 22 describes the sub-steps for updating generation templates from evolved source code;

[0058]FIG. 23 is pseudo-code for the algorithm parseSourceCode;

[0059]FIG. 24 is pseudo-code for the algorithm getHeaderClass;

[0060]FIG. 25 is pseudo-code for the algorithm getAttributes;

[0061]FIG. 26 is pseudo-code for the algorithm getMethods;

[0062]FIG. 27 is pseudo-code for the algorithm reportDeltaCode;

[0063]FIG. 28 comprises FIG. 28A and FIG. 28B and is pseudo-code for the algorithm reportChanges;

[0064]FIG. 29 is pseudo-code for the algorithm updateBusinessLogic;

[0065]FIG. 30 is pseudo-code for the algorithm isClassInfrastructureCode;

[0066]FIG. 31 is pseudo-code for the algorithm isAttributeInfrastructureCode;

[0067]FIG. 32 is pseudo-code for the algorithm isMethodInfrastructureCode;

[0068]FIG. 33 is the source code of the class Account;

[0069]FIG. 34 is the source code of the class Customer;

[0070]FIG. 35 is the source code of the class BankTransaction;

[0071]FIG. 36 is the source code of the class CheckingAccount;

[0072]FIG. 37 is the source code of the class SavingAccount;

[0073]FIG. 38 is the source code of the class Withdrawal;

[0074]FIG. 39 is the source code of the class Deposit;

[0075]FIG. 40 is the source code of the class Currency;

[0076]FIG. 41 is the source code of the class Account;

[0077]FIG. 42 is the source code of the class BankTransaction;

[0078]FIG. 43 is the source code of the class CheckingAccount;

[0079]FIG. 44 is the source code of the class SavingAccount;

[0080]FIG. 45 is the source code of the class Customer;

[0081]FIG. 46 is the source code of the class Deposit;

[0082]FIG. 47 is the source code of the class Withdrawal;

[0083]FIG. 48 comprises FIG. 48A and FIG. 48B and is the source code of the class AccountBean;

[0084]FIG. 49 comprises FIG. 49A and FIG. 49B and is the source code of the class BankTransactionBean;

[0085]FIG. 50 is the source code of the class CheckingAccountBean;

[0086]FIG. 51 is the source code of the class SavingAccountBean;

[0087]FIG. 52 is the source code of the class CustomerBean;

[0088]FIG. 53 is the source code of the class DepositBean;

[0089]FIG. 54 is the source code of the class WithdrawalBean;

[0090]FIG. 55 is the source code of the class AccountHome;

[0091]FIG. 56 is the source code of the class BankTransactionHome;

[0092]FIG. 57 is the source code of the class CheckingAccountHome;

[0093]FIG. 58 is the source code of the class SavingAccountHome;

[0094]FIG. 59 is the source code of the class CustomerHome;

[0095]FIG. 60 is the source code of the class DepositHome;

[0096]FIG. 61 is the source code of the class WithdrawalHome;

[0097]FIG. 62 is pseudo-code for the algorithm retrieveBusinessClasses;

[0098]FIG. 63 is pseudo-code for the algorithm patternMatching;

[0099]FIG. 64 is pseudo-code for the algorithm extractArchitecturalLayers;

[0100]FIG. 65 is pseudo-code for the algorithm retrieveAttributesForBusinessClasses;

[0101]FIG. 66 is pseudo-code for the algorithm getRelatedClasses;

[0102]FIG. 67is pseudo-code for the algorithm retrieveMethodsForBusinessClasses;

[0103]FIG. 68 is pseudo-code for the algorithm classDerivationMapping;

[0104]FIG. 69 is pseudo-code for the algorithm createClassAndInterfaceTemplates;

[0105]FIG. 70 is pseudo-code for the algorithm expressExtendInterfaceAsContextVariables;

[0106]FIG. 71 is pseudo-code for the algorithm expressInterfacePackageAsContextVariables;

[0107]FIG. 72 is pseudo-code for the algorithm expressInterfaceNameAsContextVariables;

[0108]FIG. 73 is pseudo-code for the algorithm expressSuperclassPackageAsContextVariables;

[0109]FIG. 74 is pseudo-code for the algorithm expressSuperclassNameAsContextVariables;

[0110]FIG. 75 is pseudo-code for the algorithm expressClassPackageAsContextVariables;

[0111]FIG. 76 is pseudo-code for the algorithm expressClassNameAsContextVariables;

[0112]FIG. 77 is pseudo-code for the algorithm attributeDerivationMapping;

[0113]FIG. 78 is pseudo-code for the algorithm createAttributeTemplates;

[0114]FIG. 79 is pseudo-code for the algorithm expressAttributeNameAsContextVariables;

[0115]FIG. 80 is pseudo-code for the algorithm expressAttributeTypeAsContextVariables;

[0116]FIG. 81 comprises FIG. 81A and FIG. 81B and is pseudo-code for the algorithm methodDerivationMapping;

[0117]FIG. 82 comprises FIG. 82A and FIG. 82B and is pseudo-code for the algorithm createMethodTemplates;

[0118]FIG. 83 is pseudo-code for the algorithm expressMethodNameAsContextVariables;

[0119]FIG. 84 is pseudo-code for the algorithm expressReturnTypeAsContextVariables;

[0120]FIG. 85 is pseudo-code for the algorithm expressParametersAsContextVariables;

[0121]FIG. 86 is pseudo-code for the algorithm abstractBodyOfMethodTemplates; and

[0122]FIG. 87 is pseudo-code for the algorithm replaceConcreteInstancesWithContextVariables;

[0123]FIG. 88 is pseudo-code for the algorithm updateBusinessClasses;

[0124]FIG. 89 is pseudo-code for the algorithm updateAttributesForBusinessClasses;

[0125]FIG. 90 is pseudo-code for the algorithm updateMethodsForBusinessClasses;

[0126] In the figures, [ref to patent] refers to international patent application PCT/CA99/00929 filed Oct. 12, 1999 by the Applicant.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0127] While illustrated in the block diagrams as groups of discrete components communicating with each other via distinct data signal connections, it will be understood by those skilled in the art that the preferred embodiments are provided by a combination of hardware and software components, with some components being implemented by a given function or operation of a hardware or software system, and many of the data paths illustrated being implemented by data communication within a computer application or operating system. The structure illustrated is thus provided for efficiency of teaching the present preferred embodiment.

[0128] SCENARIO 1

[0129] Let sourceCode1 be a component-based source code, businessLogic1 be the abstract representation of its business logic, and projGen a set of generation templates used to generate sourceCode1 from businessLogic1 [see international patent application PCT/CA99/00929 filed Oct. 12, 1999 by the applicant]. Assuming that sourceCode1 has evolved to sourceCode2, to ensure the consistency between source code and its abstract representation, the reverse-engineering engine follows the process described in FIG. 2. This process consists of four steps: parse sourceCode1, parse sourceCode2, report Δ code, and update businessLogic1 to be compliant with sourceCode2. Note that the first step is optional if sourceCode1 does not exist.

[0130] The parsing steps (200 and 205) consist of getting the meta-data of source code including packages, classes, class and component attributes, and class and component methods. Note that non-primitive attributes are considered as associations between classes. The algorithm for the parsing steps is described in FIG. 23, the pseudo-code for the algorithm parseSourceCode. FIG. 24, is the pseudo-code for the algorithm getHeaderClass. FIG. 25, is the pseudo-code for the algorithm getAttributes, and FIG. 26, is the pseudo-code for the algorithm getMethods.

[0131] The step ‘report Δ code’ (210) provides the following information:

[0132] What are the classes of sourceCode2 that do not exist in sourceCode1?

[0133] What are the classes of sourceCode1 that do not exist anymore in sourceCode2?

[0134] What are the classes of sourceCode1 that are changed in sourceCode2?

[0135] For each changed class of sourceCode2,

[0136] What are the new attributes?

[0137] What are the suppressed attributes?

[0138] What are the updated attributes?

[0139] What are the new methods?

[0140] What are the suppressed methods?

[0141] What are the updated methods?

[0142] What are the new associations?

[0143] What are the suppressed associations?

[0144] What are the updated associations?

[0145] The algorithm of step 210 is described in FIG. 27, the pseudo-code for the algorithm reportDeltaCode and FIG. 28, which comprises FIG. 28A and FIG. 28B which is the pseudo-code for the algorithm reportChanges.

[0146] The last step, ‘update businessLogic1,’ (215) consists of updating the abstract representation of the component source code with the information reported by the preceding step and filtered with the generation templates contained in projGen. In fact, the abstract representation is not polluted with the portions of source code that are generated from user-selected generation templates. The algorithm of the step 215 is described in FIG. 29, which is pseudo-code for the algorithm updateBusinessLogic, FIG. 30, which is pseudo-code for the algorithm isClassInfrastructureCode, FIG. 31, which is pseudo-code for the algorithm isAttributeInfrastructureCode, and FIG. 32, which is pseudo-code for the algorithm isMethodInfrastructureCode.

[0147]FIG. 3 shows the higher abstract representation (businessLogic1) of a simplified version of a Bank system. This system consists of seven business objects: ‘Customer’, ‘Account’, ‘SavingAccount’, ‘CheckingAccount’, ‘BankTransaction’, ‘Withdrawal’, and ‘Deposit.’ A customer could have one or many accounts. An account could be a savings account or a checking account. A transaction, which could be a withdrawal or a deposit, is performed on one account. FIG. 4 shows eight generation templates: ‘model class’, ‘model attributes’, ‘association card max=1’, ‘association card max=N’, ‘get selector’, ‘set selector’, ‘add element of associations card max=N’, and ‘remove element card max=N’. These templates are transformations rules that enable the generation from businessLogic1 of the source code (sourceCode1) presented in FIGS. 33-39. FIG. 33 is the source code of the class Account. FIG. 34 is the source code of the class Customer. FIG. 35 is the source code of the class BankTransaction. FIG. 36 is the source code of the class CheckingAccount. FIG. 37 is the source code of the class SavingAccount. FIG. 38 is the source code of the class Withdrawal. Finally, FIG. 39 is the source code of the class Deposit.

[0148] FIGS. 5-12 present the details of these generation templates. For instance, FIG. 9 shows the template ‘get selector’ that generates one get selector method for each attribute of the business objects. It generates, for example, the method ‘getCustomerNumber’ in the ‘Account’ class for the attribute ‘customerNumber’.

[0149] The source code described above has evolved to sourceCode2. This evolution consists of:

[0150] A new attribute ‘workPhone’ of type ‘String’ in the class ‘Customer’

[0151] A new method ‘getWorkPhone’ in the class ‘Customer’.

[0152] A new method setWorkPhone in the class ‘Customer’.

[0153] A new attribute ‘currrency’ of type ‘Currency’ in the class ‘Account’

[0154] A new method ‘getCurrency’ in the class ‘Account’.

[0155] A new method setCurrency in the class ‘Account’.

[0156] A new class ‘Currency’ as described in FIG. 40.

[0157] Assuming that all the generation templates are selected by the user as the filter for the process of ensuring the consistency between sourceCode2 and businessLogic1, the process will update businessLogic1 by adding to the model (see FIG. 13):

[0158] A new attribute ‘workPhone’ of type ‘String’ in the class ‘Customer’

[0159] A new class ‘Currency’ with three attributes:

[0160] An attribute ‘currencyType’ of type ‘String’.

[0161] An attribute ‘name’ of type ‘String’.

[0162] An attribute ‘shortName’ of type ‘String’.

[0163] A new association between the classes ‘Account’ and ‘Currency’.

[0164] Note that all implementation details (get and set selector methods) are not reflected in businessLogic1 since they are filtered by the generation templates ‘get selector’ and ‘set selector.’ In fact, when handling these methods, the engine in step 215 (see the algorithm of the function updateBusinessLogic), does not add these methods since they are infrastructure code. Therefore the function ‘isMethodInfrastructureCode’ (line 270) returns ‘True,’ as the methods can be generated by the templates ‘get selector’ and ‘set selector’.

[0165] SCENARIO 2

[0166] Let sourceCode be component-based source code. Extracting the business logic and generation templates of sourceCode is a process of five steps (see FIG. 14): parse sourceCode, extract businessLogic, construct class and interface templates, construct attribute templates, and construct method templates.

[0167] The step ‘parse sourceCode’ (1400) consists of analyzing the source code structurally and is same as the first step (200) of the first scenario.

[0168] The step ‘extract businessLogic’ (1405) consists of getting from the structural meta-data associated with the business logic of the source code. It comprises three sub-steps (see FIG. 15): retrieve business classes, retrieve attributes of business classes, and retrieve methods of business classes.

[0169] The algorithm of retrieving business classes (1500) is presented below. A class is a candidate business class if its name satisfies one of the two following criteria:

[0170] It is a pattern of the name of some of the other classes (line 1330), or

[0171] Its name does not contain an architectural layer as a pattern (line 1337).

[0172] For instance, the source code of a simplified version of a Bank system described in the appendix consists of twenty-one Java classes and interfaces: ‘Account’, ‘BankTransaction’, ‘CheckingAccount’, ‘SavingAccount’, ‘Customer’, ‘Deposit’, ‘Withdrawal, ‘AccountBean’, ‘BankTransactionBean’, ‘CheckingAccountBean’, ‘SavingAccountBean’, ‘CustomerBean’, ‘DepositBean’, WithdrawalBean, ‘AccountHome’, ‘BankTransactionHome’, ‘CheckingAccountHome’, ‘SavingAccountHome’, ‘CustomerHome’, ‘DepositHome’, and ‘WithdrawalHome. The candidate business classes are: ‘Account’, ‘BankTransaction’, ‘CheckingAccount’, ‘SavingAccount’, ‘Customer’, ‘Deposit’, and ‘Withdrawal’. In fact, the name of the ‘Account’ class (i.e. ‘Account’) is a pattern in the name of other classes such as ‘AccountBean’ and ‘AccountHome’. The same reasoning applies to ‘BankTransaction’, ‘CheckingAccount’, ‘SavingAccount’, ‘Customer’, ‘Deposit’, and ‘Withdrawal’.

[0173]FIG. 41 is the source code of the class Account; FIG. 42 is the source code of the class BankTransaction; FIG. 43 is the source code of the class CheckingAccount; FIG. 44 is the source code of the class SavingAccount; FIG. 45 is the source code of the class Customer; FIG. 46 is the source code of the class Deposit; FIG. 47 is the source code of the class Withdrawal; FIG. 48 comprises FIG. 48A and FIG. 48B and is the source code of the class AccountBean; FIG. 49 comprises FIG. 49A and FIG. 49B and is the source code of the class BankTransactionBean; FIG. 50 is the source code of the class CheckingAccountBean; FIG. 51 is the source code of the class SavingAccountBean; FIG. 52 is the source code of the class CustomerBean; FIG. 53 is the source code of the class DepositBean; FIG. 54 is the source code of the class WithdrawalBean; FIG. 55 is the source code of the class AccountHome; FIG. 56 is the source code of the class BankTransactionHome; FIG. 57 is the source code of the class CheckingAccountHome; FIG. 58 is the source code of the class SavingAccountHome; FIG. 59 is the source code of the class CustomerHome; FIG. 60 is the source code of the class DepositHome; FIG. 61 is the source code of the class WithdrawalHome.

[0174]FIG. 62 is pseudo-code for the algorithm retrieveBusinessClasses (1500). FIG. 63 is pseudo-code for the algorithm patternMatching. FIG. 64 is pseudo-code for the algorithm extractArchitecturalLayers.

[0175] The algorithm for retrieving attributes of business classes (1423) is presented below.

[0176] An attribute is a candidate attribute of a business class if it satisfies two criteria:

[0177] It is an attribute of one of the classes that has in its name the business class name as a pattern (line 1439).

[0178] It does not exist in other classes that have in their name a pattern other than the business class name (lines 1440-1443).

[0179] For instance, the candidate attributes of the business class ‘Account’ are ‘accountNumber’, ‘balance’, ‘openDate’, and ‘customer’ since these attributes belong to the class ‘AccountBean.java’ and do not exist in other classes, such as ‘BankTransactionBean’ or ‘CustomerBean’, which have the pattern ‘Bean’ in their names. Note that the attribute ‘entityContext’ is not a candidate for the ‘Account’ class since it exists in other classes such as ‘CustomerBean’.

[0180]FIG. 65 is pseudo-code for the algorithm retrieveAttributesForBusinessClasses (1423). FIG. 66 is pseudo-code for the algorithm getRelatedClasses.

[0181] The algorithm for retrieving methods of business classes (FIG. 67) is presented below.

[0182] A method is a candidate method of a business class if it satisfies three criteria:

[0183] It is a method of one of the classes that has in its name the business class name as a pattern (line 1541).

[0184] Its name does not have the name of one of the attributes of the class or the business class as a pattern (lines 1543-1545).

[0185] It does not exist in other classes that have in their name a pattern other than the business class name (lines 1546-1548).

[0186] For instance, the class ‘Account’ does not have candidate methods since no methods in ‘AccountBean.java’ and ‘AccountHome.java’ satisfy the three criteria. In fact, the methods ‘ejbActivate’, ‘ejbCreate’, ‘ejbLoad’, ‘ejbPassivate’, ejbPostCreate’, ‘ejbRemove’, ‘ejbStore’, also exist, for instance, in ‘CheckingAccount.java,’ and ‘create’ also exists in ‘CheckingAccountHome.. The selector methods (e.g. ‘getAccountNumber’) correspond to one of the attributes of ‘AccountBean.java’. The business logic of the ‘Bank’ system is described in FIG. 16. Note that non-primitive attributes are considered as associations between classes.

[0187] See FIG. 67, which is pseudo-code for the algorithm retrieveMethodsForBusinessClasses (1526).

[0188] The step ‘construct class and interface templates’ (1410) consists of two sub-steps (see FIG. 17): construct class derivation mapping and create class and interface templates. The algorithm of class derivation mapping is illustrated below (step 1700). The algorithm uses the architectural layers that exist in the source code. For each architectural layer, the algorithm constructs a derivation mapping between a business class and every class that has in its name the layer as a pattern (lines 1583-1597). For instance for the ‘Bean’ layer, derivation mappings are constructed between:

[0189] ‘Account’ and ‘AccountBean’

[0190] ‘BankTransaction’ and ‘BankTransactionBean’

[0191] ‘CheckingAccount’ and ‘CheckingAccountBean’

[0192] ‘SavingAccount’ and ‘SavingAccountBean’

[0193] ‘Customer’ and ‘CustomerBean’

[0194] ‘Deposit’ and ‘DepositBean’

[0195] ‘Withdrawal’ and ‘WithdrawalBean’.

[0196] Moreover, a derivation mapping is constructed between every business class and itself (lines 1599-1607). The remaining derivation mapping, including those for the home layer, are therefore:

[0197] ‘Account’ and ‘Account’

[0198] ‘BankTransaction’ and ‘BankTransaction’

[0199] ‘CheckingAccount’ and ‘CheckingAccount’

[0200] ‘SavingAccount’ and ‘SavingAccount’

[0201] ‘Customer’ and ‘Customer’

[0202] ‘Deposit’ and ‘Deposit’

[0203] ‘Withdrawal’ and ‘Withdrawal’

[0204] ‘Account’ and ‘AccountHome’

[0205] ‘BankTransaction’ and ‘BankTransactionHome’

[0206] ‘CheckingAccount’ and ‘CheckingAccountHome’

[0207] ‘SavingAccount’ and ‘SavingAccountHome’

[0208] ‘Customer’ and ‘CustomerHome’

[0209] ‘Deposit’ and ‘DepositHome’

[0210] ‘Withdrawal’ and ‘WithdrawalHome’.

[0211] See FIG. 68, which is pseudo-code for the algorithm classDerivationMapping.

[0212] The algorithm of class and interface creation (step 1705) is described below.

[0213] For each derivation mapping, an interface (respectively, a class) template is created if the derived element is an interface (respectively, a class). For instance, the derivation mapping described above will create:

[0214] A class template for the ‘Account’ and ‘AccountBean’ derivation mapping with the following information:

[0215] superclass package: ‘<source_superclass_package/>’

[0216] superclass name: ‘<source_superclass_name/>’

[0217] abstract modifier: ‘public’

[0218] package: ‘<source_class_package/>’

[0219] name: ‘<source_class_name/>’

[0220] implements interface: ‘javax.ejb.EntityBean’.

[0221] A class template for the ‘BankTransaction’ and ‘BankTransactionBean’ derivation mapping with the following information:

[0222] superclass package: ‘<source_superclass_package/>’

[0223] superclass name: ‘<source_superclass_name/>’

[0224] abstract modifier: ‘public’

[0225] package: ‘<source_class_package/>’

[0226] name: ‘<source_class_name/>’

[0227] implements interface: ‘javax.ejb.EntityBean’.

[0228] A class template for the ‘CheckingAccount’ and ‘CheckingAccountBean’ derivation mapping with the following information:

[0229] superclass package: ‘<source_superclass_package/>’

[0230] superclass name: ‘<source_superclass_name/>’

[0231] abstract modifier: ‘public’

[0232] package: ‘<source_class_package/>’

[0233] name: ‘<source_class_name/>’

[0234] implements interface: ‘javax.ejb.EntityBean’.

[0235] A class template for the ‘SavingAccount’ and ‘SavingAccountBean’ derivation mapping with the following information:

[0236] superclass package: ‘<source_superclass_package/>’

[0237] superclass name: ‘<source_superclass_name/>’

[0238] abstract modifier: ‘public’

[0239] package: ‘<source_class_package/>’

[0240] name: ‘<source_class_name/>’implements interface: ‘javax.ejb.SessionBean’.

[0241] A class template for the ‘Customer’ and ‘CustomerBean’ derivation mapping with the following information:

[0242] superclass package: ‘<source_superclass_package/>’

[0243] superclass name: ‘<source_superclass_name/>’

[0244] abstract modifier: ‘public’

[0245] package: ‘<source_class_package/>’

[0246] name: ‘<source_class_name/>’

[0247] implements interface: ‘javax.ejb.SessionBean’.

[0248] A class template for the ‘Deposit’ and ‘DepositBean’ derivation mapping with the following information:

[0249] superclass package: ‘<source_superclass_package/>’

[0250] superclass name: ‘<source_superclass_name/>’

[0251] abstract modifier: ‘public’

[0252] package: ‘<source_class_package/>’

[0253] name: ‘<source_class_name/>’

[0254] implements interface: ‘javax.ejb.SessionBean’.

[0255] A class template for the ‘Withdrawal’ and ‘WithdrawalBean’ derivation mapping with the following information:

[0256] superclass package: ‘<source_superclass_package/>’

[0257] superclass name: ‘<source_superclass_name/>’

[0258] abstract modifier: ‘public’

[0259] package: ‘<source_class_package/>’

[0260] name: ‘<source_class_name/>’

[0261] implements interface: ‘javax.ejb.SessionBean’.

[0262] An interface template for the ‘Account’ and ‘Account’ derivation mapping with the following information:

[0263] Extends interfaces: ‘EJBObject’

[0264] abstract modifier: ‘public’

[0265] package: ‘<source_class_package/>’

[0266] name: ‘<source_class_name/>’.

[0267] An interface template for the ‘BankTransaction’ and ‘BankTransaction’ derivation mapping with the following information:

[0268] Extends interfaces: ‘EJBObject’

[0269] abstract modifier: ‘public’

[0270] package: ‘<source_class_package/>’

[0271] name: ‘<source_class_name/>’.

[0272] An interface template for the ‘CheckingAccount’ and ‘CheckingAccount’ derivation mapping with the following information:

[0273] Extends interfaces: ‘<source_super_class/>’

[0274] abstract modifier: ‘public’

[0275] package: ‘<source_class_package/>’

[0276] name: ‘<source_class_name/>’.

[0277] An interface template for the ‘SavingAccount’ and ‘SavingAccount’ derivation mapping with the following information:

[0278] Extends interfaces: ‘<source_super_class/>’

[0279] abstract modifier: ‘public’

[0280] package: ‘<source_class_package/>’

[0281] name: ‘<source_class_name/>’.

[0282] An interface template for the ‘Customer’ and ‘Customer’ derivation mapping with the following information:

[0283] Extends interfaces: ‘EJBObject’

[0284] abstract modifier: ‘public’

[0285] package: ‘<source_class_package/>’

[0286] name: ‘<source_class_name/>’.

[0287] An interface template for the ‘Deposit’ and ‘Deposit’ derivation mapping with the following information:

[0288] Extends interfaces: ‘<source_super_class/>’

[0289] abstract modifier: ‘public’

[0290] package: ‘<source_class_package/>’

[0291] name: ‘<source_class_name/>’.

[0292] An interface template for the ‘Withdrawal’ and ‘Withdrawal’ derivation mapping with the following information:

[0293] Extends interfaces: ‘<source_super_class/>’

[0294] abstract modifier: ‘public’

[0295] package: ‘<source_class_package/>’

[0296] name: ‘<source_class_name/>’.

[0297] An interface template for the ‘Account’ and ‘AccountHome’ derivation mapping with the following information:

[0298] Extends interfaces: ‘EJBHome’

[0299] abstract modifier: ‘public’

[0300] package: ‘<source_class_package/>’

[0301] name: ‘<source_class_name/>’.

[0302] An interface template for the ‘BankTransaction’ and ‘BankTransactionHome’ derivation mapping with the following information:

[0303] Extends interfaces: ‘EJBHome’

[0304] abstract modifier: ‘public’

[0305] package: ‘<source_class_package/>’

[0306] name: ‘<source_class_name/>’.

[0307] An interface template for the ‘CheckingAccount’ and ‘CheckingAccountHome’ derivation mapping with the following information:

[0308] Extends interfaces: ‘<source_super_class/>Home’

[0309] abstract modifier: ‘public’

[0310] package: ‘<source_class_package/>’

[0311] name: ‘<source_class_name/>’.

[0312] An interface template for the ‘SavingAccount’ and ‘SavingAccountHome’ derivation mapping with the following information:

[0313] Extends interfaces: ‘<source_super_class/>Home’

[0314] abstract modifier: ‘public’

[0315] package: ‘<source_class_package/>’

[0316] name: ‘<source_class_name/>’.

[0317] An interface template for the ‘Customer’ and ‘CustomerHome’ derivation mapping with the following information:

[0318] Extends interfaces: ‘EJBHome’

[0319] abstract modifier: ‘public’

[0320] package: ‘<source_class_package/>’

[0321] name: ‘<source_class_name/>’.

[0322] An interface template for the ‘Deposit’ and ‘DepositHome’ derivation mapping with the following information:

[0323] Extends interfaces: ‘<source_super_class/>Home’

[0324] abstract modifier: ‘public’

[0325] package: ‘<source_class_package/>’

[0326] name: ‘<source_class_name/>’.

[0327] An interface template for the ‘Withdrawal’ and ‘WithdrawalHome’ derivation mapping with the following information:

[0328] Extends interfaces: ‘<source_super_class/>Home’

[0329] abstract modifier: ‘public’

[0330] package: ‘<source_class_package/>’

[0331] name: ‘<source_class_name/>’.

[0332] After duplicate templates are removed (line 1674), two class templates and four interface templates remain. See FIG. 69, which is pseudo-code for the algorithm createClassAndInterfaceTemplates (1618). Note that this algorithm uses the following algorithms for expressing template information with context variables:

[0333] expressExtendInterfaceAsContextVariables, described in FIG. 70;

[0334] expressInterfacePackageAsContextVariables, described in FIG. 71;

[0335] expressInterfaceNameAsContextVariables, described in FIG. 72;

[0336] expressSuperclassPackageAsContextVariables, described in FIG. 73;

[0337] expressSuperclassNameAsContextVariables, described in FIG. 74;

[0338] expressClassPackageAsContextVariables, described in FIG. 75;

[0339] expressClassNameAsContextVariables, described in FIG. 76.

[0340] The step ‘construct attribute templates’ (1415) is composed of two sub-steps (see FIG. 18): construct attribute derivation mapping and create attribute templates. The algorithm of attribute derivation mapping is illustrated below (step 1800). It constructs a mapping for every attribute of derived classes. An attribute of a class is derived from an attribute of the origin class if the latter attribute is a pattern of the former attribute (lines 1907-1923). Otherwise, the origin of the attribute is undefined (lines 1925-1937). For the Bank system, for instance, the following derivation mapping information is obtained:

[0341] For the ‘AccountBean’ class:

[0342] The attribute ‘accountNumber’ is derived from the attribute ‘accountNumber’ of the business class ‘Account’.

[0343] The attribute ‘balance’ is derived from the attribute ‘balance’ of the business class ‘Account’.

[0344] The attribute ‘openDate’ is derived from the attribute ‘openDate’ of the business class ‘Account’.

[0345] The attribute ‘customer’ is derived from the attribute ‘customer’ of the business class ‘Account’.

[0346] The origin of the attribute ‘entityContext is undefined.

[0347] For the ‘BankTransactionBean’ class:

[0348] The attribute ‘amount’ is derived from the attribute ‘amount’ of the business class ‘BankTransaction’.

[0349] The attribute ‘dateTime’ is derived from the attribute ‘dateTime’ of the business class ‘BankTransaction’.

[0350] The attribute ‘transactionNumber’ is derived from the attribute ‘transactionNumber’ of the business class ‘BankTransaction’.

[0351] The attribute ‘account’ is derived from the attribute ‘account’ of the business class ‘BankTransaction’.

[0352] The origin of the attribute ‘sessionContext is undefined.

[0353] For the ‘CheckingAccountBean’ class:

[0354] The origin of the attribute ‘entityContext is undefined.

[0355] For the ‘SavingAccountBean’ class:

[0356] The origin of the attribute ‘entityContext is undefined.

[0357] For the ‘CustomerBean’ class:

[0358] The attribute ‘customerNumber’ is derived from the attribute ‘customerNumber’ of the business class ‘Customer’.

[0359] The attribute ‘homePhone’ is derived from the attribute ‘homePhone’ of the business class ‘Customer’.

[0360] The attribute ‘name’ is derived from the attribute ‘name’ of the business class ‘Customer’.

[0361] The origin of the attribute ‘sessionContext is undefined.

[0362] For the ‘DepositBean’ class:

[0363] The origin of the attribute ‘sessionContext is undefined.

[0364] For the ‘WithdrawalBean’ class:

[0365] The origin of the attribute ‘sessionContext is undefined.

[0366]FIG. 77 is pseudo-code for the algorithm attributeDerivationMapping.

[0367] The algorithm of attribute template creation is described below (1805). For each attribute derivation mapping:

[0368] An attribute template that iterates over classes is created if the origin of the derived attribute is undefined (lines 1958-1959).

[0369] An attribute template that iterates over source attributes if the origin of the attribute is known (lines 1962-1963).

[0370] For instance, the attribute derivation mapping described above will create:

[0371] An attribute template that iterates over source attributes for the ‘accountNumber’ and accountNumber’ attribute derivation mapping with the following information:

[0372] name: <source_attribute/>

[0373] type: <source_attribute_type/>

[0374] access modifier: private

[0375] An attribute template that iterates over source attributes for the ‘balance’ and ‘balance’ attribute derivation mapping with the following information:

[0376] name: <source_attribute/>

[0377] type: <source_attribute_type/>

[0378] access modifier: private

[0379] An attribute template that iterates over source attributes for the ‘openDate’ and ‘openDate’ attribute derivation mapping with the following information:

[0380] name: <source_attribute/>

[0381] type: <source_attribute_type/>

[0382] access modifier: private

[0383] An attribute template that iterates over source attributes for the ‘customer’ and ‘customer’ attribute derivation mapping with the following information:

[0384] name: <source_attribute/>

[0385] type: <source_attribute_type/>

[0386] access modifier: private

[0387] An attribute template that iterates over classes for the ‘entityContext’ and ‘undefined’ attribute derivation mapping with the following information:

[0388] name: entityContext

[0389] type: EntityContext

[0390] access modifier: transient protected

[0391] An attribute template that iterates over source attributes for the ‘amount’ and ‘amount’ attribute derivation mapping with the following information:

[0392] name: <source_attribute/>

[0393] type: <source_attribute_type/>

[0394] access modifier: private

[0395] An attribute template that iterates over source attributes for the ‘dateTime’ and ‘dateTime’ attribute derivation mapping with the following information:

[0396] name: <source_attribute/>

[0397] type: <source_attribute_type/>

[0398] access modifier: private

[0399] An attribute template that iterates over source attributes for the ‘transactionNumber’ and ‘transactionNumber’ attribute derivation mapping with the following information:

[0400] name: <source_attribute/>

[0401] type: <source_attribute_type/>

[0402] access modifier: private

[0403] An attribute template that iterates over source attributes for the ‘account’ and ‘account’ attribute derivation mapping with the following information:

[0404] name: <source_attribute/>

[0405] type: <source_attribute_type/>

[0406] access modifier: private

[0407] An attribute template that iterates over classes for the ‘sessionContext’ and ‘undefined’ attribute derivation mapping with the following information:

[0408] name: sessionContext

[0409] type: sessionContext

[0410] access modifier: transient protected

[0411] An attribute template that iterates over source attributes for the ‘customerNumber’ and ‘customerNumber’ attribute derivation mapping with the following information:

[0412] name: <source_attribute/>

[0413] type: <source_attribute type/>

[0414] access modifier: private

[0415] An attribute template that iterates over source attributes for the ‘homephone’ and ‘homePhone’ attribute derivation mapping with the following information:

[0416] name: <source_attribute/>

[0417] type: <source_attribute_type/>

[0418] access modifier: private

[0419] An attribute template that iterates over source attributes for the ‘name’ and ‘name’ attribute derivation mapping with the following information:

[0420] name: <source_attribute/>

[0421] type: <source_attribute_type/>

[0422] access modifier: private

[0423] After duplicate templates are removed (line 1981), there remain two attribute templates that iterate over classes and one attribute template that iterates over source attributes. FIG. 78 is pseudo-code for the algorithm createAttributeTemplates; FIG. 79 is pseudo-code for the algorithm expressAttributeNameAsContextVariables; FIG. 80 is pseudo-code for the algorithm expressAttributeTypeAsContextVariables;

[0424] The step ‘construct method templates’ (1420) is composed of three sub-steps (see FIG. 19): construct method derivation mapping, create method templates, and abstract the body of each method template. The algorithm of method derivation mapping is presented below (1900). It constructs a mapping for every method of derived classes. Three cases are considered:

[0425] A method of a class is derived from a method of the origin class if the latter method is a pattern of the former method (lines 2067-2080).

[0426] A method of a class is derived from an attribute of the origin class if the latter attribute is a pattern of the former method (lines 2082-2098).

[0427] Otherwise, the origin of the method is undefined (lines 2115-2125).

[0428] For the Bank system, for instance, the following derivation mapping information is obtained:

[0429] For the ‘AccountBean’ class:

[0430] The origin of the method ‘ejbActivate’ is undefined.

[0431] The origin of the method ‘ejbCreate’ is undefined.

[0432] The origin of the method ‘ejbLoad’ is undefined.

[0433] The origin of the method ‘ejbPassivate’ is undefined.

[0434] The origin of the method ‘ejbPostCreate’ is undefined.

[0435] The origin of the method ‘ejbRemove’ is undefined.

[0436] The origin of the method ‘ejbStore’ is undefined.

[0437] The method ‘getAccountNumber’ is derived from the attribute ‘accountNumber’ of the business class ‘Account’.

[0438] The method ‘getBalance’ is derived from the attribute ‘balance’ of the business class ‘Account’.

[0439] The method ‘getOpenDate’ is derived from the attribute ‘openDate’ of the business class ‘Account’.

[0440] The method ‘getCustomer’ is derived from the attribute ‘customer’ of the business class ‘Account’.

[0441] The method ‘setAccountNumber’ is derived from the attribute ‘accountNumber’ of the business class ‘Account’.

[0442] The method ‘setBalance’ is derived from the attribute ‘balance’ of the business class ‘Account’.

[0443] The method ‘setOpenDate’ is derived from the attribute ‘openDate’ of the business class ‘Account’.

[0444] The method ‘setCustomer’ is derived from the attribute ‘customer’ of the business class ‘Account’.

[0445] The origin of the method ‘setEntityContext is undefined.

[0446] The origin of the method ‘unsetEntityContext is undefined.

[0447] For the ‘BankTransactionBean’ class:

[0448] The origin of the method ‘ejbActivate’ is undefined.

[0449] The origin of the method ‘ejbCreate’ is undefined.

[0450] The origin of the method ‘ejbLoad’ is undefined.

[0451] The origin of the method ‘ejbPassivate’ is undefined.

[0452] The origin of the method ‘ejbRemove’ is undefined.

[0453] The origin of the method ‘ejbStore’ is undefined.

[0454] The method ‘getAmount’ is derived from the attribute ‘amount’ of the business class ‘BankTransaction’.

[0455] The method ‘getDateTime’ is derived from the attribute ‘dateTime’ of the business class ‘BankTransaction’.

[0456] The method ‘getTransactionNumber’ is derived from the attribute ‘transactionNumber’ of the business class ‘BankTransaction’.

[0457] The method ‘getAccount’ is derived from the attribute ‘account’ of the business class ‘BankTransaction’.

[0458] The method ‘setAmount’ is derived from the attribute ‘amount’ of the business class ‘BankTransaction’.

[0459] The method ‘setDateTime’ is derived from the attribute ‘dateTime’ of the business class ‘BankTransaction’.

[0460] The method ‘setTransactionNumber’ is derived from the attribute ‘transactionNumber’ of the business class ‘BankTransaction’.

[0461] The method ‘setAccount’ is derived from the attribute ‘account’ of the business class ‘BankTransaction’.

[0462] The origin of the method ‘setSessionContext is undefined.

[0463] The origin of the method ‘unsetSessionContext is undefined.

[0464] For the ‘CheckingAccountBean’ class:

[0465] The origin of the method ‘ejbActivate’ is undefined.

[0466] The origin of the method ‘ejbCreate’ is undefined.

[0467] The origin of the method ‘ejbLoad’ is undefined.

[0468] The origin of the method ‘ejbPassivate’ is undefined.

[0469] The origin of the method ‘ejbRemove’ is undefined.

[0470] The origin of the method ‘ejbStore’ is undefined.

[0471] The origin of the method ‘setEntityContext is undefined.

[0472] The origin of the method ‘unsetEntityContext is undefined.

[0473] For the ‘SavingAccountBean’ class:

[0474] The origin of the method ‘ejbActivate’ is undefined.

[0475] The origin of the method ‘ejbCreate’ is undefined.

[0476] The origin of the method ‘ejbLoad’ is undefined.

[0477] The origin of the method ‘ejbPassivate’ is undefined.

[0478] The origin of the method ‘ejbRemove’ is undefined.

[0479] The origin of the method ‘ejbStore’ is undefined.

[0480] The origin of the method ‘setEntityContext is undefined.

[0481] The origin of the method ‘unsetEntityContext is undefined.

[0482] For the ‘CustomerBean’ class:

[0483] The origin of the method ‘ejbActivate’ is undefined.

[0484] The origin of the method ‘ejbCreate’ is undefined.

[0485] The origin of the method ‘ejbLoad’ is undefined.

[0486] The origin of the method ‘ejbPassivate’ is undefined.

[0487] The origin of the method ‘ejbRemove’ is undefined.

[0488] The origin of the method ‘ejbStore’ is undefined.

[0489] The method ‘getCustomerNumber’ is derived from the attribute ‘customerNumber’ of the business class ‘customer’.

[0490] The method ‘getHomePhone’ is derived from the attribute ‘homePhone’ of the business class ‘Customer’.

[0491] The method ‘getName’ is derived from the attribute ‘name’ of the business class ‘Customer’.

[0492] The method ‘setCustomerNumber’ is derived from the attribute ‘customerNumber’ of the business class ‘customer’.

[0493] The method ‘setHomePhone’ is derived from the attribute ‘homePhone’ of the business class ‘Customer’.

[0494] The method ‘setName’ is derived from the attribute ‘name’ of the business class ‘Customer’.

[0495] The origin of the method ‘setSessionContext is undefined.

[0496] The origin of the method ‘unsetSessionContext is undefined.

[0497] For the ‘DepositBean’ class:

[0498] The origin of the method ‘ejbActivate’ is undefined.

[0499] The origin of the method ‘ejbCreate’ is undefined.

[0500] The origin of the method ‘ejbLoad’ is undefined.

[0501] The origin of the method ‘ejbPassivate’ is undefined.

[0502] The origin of the method ‘ejbRemove’ is undefined.

[0503] The origin of the method ‘ejbStore’ is undefined.

[0504] The origin of the method ‘setSessionContext is undefined.

[0505] The origin of the method ‘unsetSessionContext is undefined.

[0506] For the ‘WithdrawalBean’ class:

[0507] The origin of the method ‘ejbActivate’ is undefined.

[0508] The origin of the method ‘ejbCreate’ is undefined.

[0509] The origin of the method ‘ejbLoad’ is undefined.

[0510] The origin of the method ‘ejbPassivate’ is undefined.

[0511] The origin of the method ‘ejbRemove’ is undefined.

[0512] The origin of the method ‘ejbStore’ is undefined.

[0513] The origin of the method ‘setSessionContext is undefined.

[0514] The origin of the method ‘unsetSessionContext is undefined.

[0515] For the ‘AccountHome’ class:

[0516] The origin of the method ‘create’ is undefined.

[0517] For the ‘BankTransactionHome’ class:

[0518] The origin of the method ‘create’ is undefined.

[0519] For the ‘CheckingAccountHome’ class:

[0520] The origin of the method ‘create’ is undefined.

[0521] For the ‘SavingAccountHome’ class:

[0522] The origin of the method ‘create’ is undefined.

[0523] For the ‘CustomerHome’ class:

[0524] The origin of the method ‘create’ is undefined.

[0525] For the ‘DepositHome’ class:

[0526] The origin of the method ‘create’ is undefined.

[0527] For the ‘WithdrawalHome’ class:

[0528] The origin of the method ‘create’ is undefined.

[0529]FIG. 81 comprises FIG. 81A and FIG. 81B and is pseudo-code for the algorithm method DerivationMapping.

[0530] The algorithm of method templates creation is described below (1905). For each method derivation mapping:

[0531] A method template that iterates over classes is created if the origin of the derived attribute is undefined (lines 2147-2149).

[0532] A method template that iterates over source attributes if the origin of the method is an attribute of the origin class (lines 2151-2154).

[0533] A method template that iterates over source operations if the origin of the method is a method of the origin class (lines 2156-2157).

[0534] For instance, the method derivation mapping described above will create:

[0535] A method template that iterates over source classes for the ‘ejbActivate’ and ‘null’method derivation mapping with the following information:

[0536] name: ejbActivate

[0537] return type: void

[0538] access modifier: public;

[0539] A method template that iterates over source classes for the ‘ejbCreate’ and ‘null’ method derivation mapping with the following information:

[0540] name: ejbCreate

[0541] return type: void

[0542] access modifier: public;

[0543] A method template that iterates over source classes for the ‘ejbLoad’ and ‘null’ method derivation mapping with the following information:

[0544] name: ejbLoad

[0545] return type: void

[0546] access modifier: public;

[0547] A method template that iterates over source classes for the ‘ejbPassivate’ and ‘null’ method derivation mapping with the following information:

[0548] name: ejbPassivate

[0549] return type: void

[0550] access modifier: public;

[0551] A method template that iterates over source classes for the ‘ejbPostCreate’ and ‘null’ method derivation mapping with the following information:

[0552] name: ejbAPostCreate

[0553] return type: void

[0554] access modifier: public;

[0555] A method template that iterates over source classes for the ‘ejbRemove’ and ‘null’ method derivation mapping with the following information:

[0556] name: ejbRemove

[0557] return type: void

[0558] access modifier: public;

[0559] A method template that iterates over source classes for the ‘ejbStore’ and ‘null’ method derivation mapping with the following information:

[0560] name: ejbStore

[0561] return type: void

[0562] access modifier: public;

[0563] A method template that iterates over source attributes for the ‘getAccountNumber’ and ‘accountNumber’ method derivation mapping with the following information:

[0564] name: get<source_attribute_name/>

[0565] return type: <source_attribute_type/>

[0566] access modifier: public

[0567] body: return accountNumber;

[0568] A method template that iterates over source attributes for the ‘getBalance’ and ‘balance’ method derivation mapping with the following information:

[0569] name: get<source_attribute_name/>

[0570] return type: <source_attribute_type/>

[0571] access modifier: public

[0572] body: return balance;

[0573] A method template that iterates over source attributes for the ‘getOpenDate’ and ‘openDate’ method derivation mapping with the following information:

[0574] name: get<source_attribute_name/>

[0575] return type: <source_attribute_type/>

[0576] access modifier: public

[0577] body: return openDate;

[0578] A method template that iterates over source attributes for the ‘getCustomer’ and ‘customer’ method derivation mapping with the following information:

[0579] name: get<source_attribute_name/>

[0580] return type: <source_attribute_type/>

[0581] access modifier: public

[0582] body: return customer;

[0583] A method template that iterates over source attributes for the ‘setAccountNumber’ and ‘accountNumber’ method derivation mapping with the following information:

[0584] name: set<source_attribute_name/>

[0585] return type: void

[0586] access modifier: public

[0587] parameters: <source_attribute_type/>a<source_attribute_name/>

[0588] body: this.accountNumber=aAccountNumber;

[0589] A method template that iterates over source attributes for the ‘setBalance’ and ‘balance’ method derivation mapping with the following information:

[0590] name: set<source_attribute_name/>

[0591] return type: void

[0592] access modifier: public

[0593] parameters: <source_attribute_type/>a<source_attribute_name/>

[0594] body: this.balance=aBalance;

[0595] A method template that iterates over source attributes for the ‘setOpenDate’ and ‘openDate’ method derivation mapping with the following information:

[0596] name: set<source_attribute_name/>

[0597] return type: void

[0598] access modifier: public

[0599] parameters: <source_attribute_type/>a<source_attribute_name/>

[0600] body: this.openDate=aOpenDate;

[0601] A method template that iterates over source attributes for the ‘setCustomer’ and ‘customer’ method derivation mapping with the following information:

[0602] name: set<source_attribute_name/>

[0603] return type: void

[0604] access modifier: public

[0605] parameters: <source_attribute_type/>a<source_attribute_name/>

[0606] body: this.customer=aCustomer;

[0607] A method template that iterates over source classes for the ‘setEntityContext’ and ‘null’ method derivation mapping with the following information:

[0608] name: setEntityContext

[0609] return type: void

[0610] access modifier: public

[0611] parameters: javax.ejb.EntityContext entityContext

[0612] body: this.entityContext=entityContext;

[0613] A method template that iterates over source classes for the ‘unsetEntityContext’ and ‘null’ method derivation mapping with the following information:

[0614] name: unsetEntityContext

[0615] return type: void

[0616] access modifier: public

[0617] body: this.entityContext=null;

[0618] A method template that iterates over source attributes for the ‘getAmount’ and ‘amount’ method derivation mapping with the following information:

[0619] name: get<source_attribute_name/>

[0620] return type: <source_attribute_type/>

[0621] access modifier: public

[0622] body: return amount;

[0623] A method template that iterates over source attributes for the ‘getDateTime’ and ‘dateTime’ method derivation mapping with the following information:

[0624] name: get<source_attribute_name/>

[0625] return type: <source_attribute_type/>

[0626] access modifier: public

[0627] body: return dateTime;

[0628] A method template that iterates over source attributes for the ‘getTransactionNumber’ and ‘transactionNumber’ method derivation mapping with the following information:

[0629] name: get<source_attribute_name/>

[0630] return type: <source_attribute_type/>

[0631] access modifier: public

[0632] body: return transactionNumber;

[0633] A method template that iterates over source attributes for the ‘getaccount’ and ‘account’ method derivation mapping with the following information:

[0634] name: get<source_attribute_name/>

[0635] return type: <source_attribute_type/>

[0636] access modifier: public

[0637] body: return account;

[0638] A method template that iterates over source attributes for the ‘setAmount’ and ‘amount’ method derivation mapping with the following information:

[0639] name: set<source_attribute_name/>

[0640] return type: void

[0641] access modifier: public

[0642] parameters: <source_attribute_type/>a<source_attribute_name/>

[0643] body: this.<amount=aAmount;

[0644] A method template that iterates over source attributes for the ‘setDateTime’ and ‘dateTime’ method derivation mapping with the following information:

[0645] name: set<source_attribute_name/>

[0646] return type: void

[0647] access modifier: public

[0648] parameters: dateTime=a<source_attribute_name/>

[0649] body: this.<source_attribute_name/>=a<DateTime;

[0650] A method template that iterates over source attributes for the ‘setTransactionNumber’ and ‘transactionNumber’ method derivation mapping with the following information:

[0651] name: set<source_attribute_name/>

[0652] return type: void

[0653] access modifier: public

[0654] parameters: transactionNumber=aTransactionNumber

[0655] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0656] A method template that iterates over source attributes for the ‘setAccount’ and ‘account’ method derivation mapping with the following information:

[0657] name: set<source_attribute_name/>

[0658] return type: void

[0659] access modifier: public

[0660] parameters: <source_attribute_type/>a<source_attribute_name/>

[0661] body: this.account=aAccount;

[0662] A method template that iterates over source classes for the ‘setSessionContext’ and ‘null’ method derivation mapping with the following information:

[0663] name: setSessionContext

[0664] return type: void

[0665] access modifier: public

[0666] parameters: javax.ejb.SessionContext SessionContext

[0667] body: this.sessionContext=sessionContext;

[0668] A method template that iterates over source classes for the ‘unsetSessionContext’ and ‘null’ method derivation mapping with the following information:

[0669] name: unsetSessionContext

[0670] return type: void

[0671] access modifier: public

[0672] body: this.sessionContext=null;

[0673] A method template that iterates over source attributes for the ‘getCustomerNumber’ and ‘customerNumber’ method derivation mapping with the following information:

[0674] name: get<source_attribute_name/>

[0675] return type: <source_attribute_type/>

[0676] access modifier: public

[0677] body: return customerNumber;

[0678] A method template that iterates over source attributes for the ‘getHomePhone’ and ‘homePhone’ method derivation mapping with the following information:

[0679] name: get<source_attribute_name/>

[0680] return type: <source_attribute_type/>

[0681] access modifier: public

[0682] body: return homePhone;

[0683] A method template that iterates over source attributes for the ‘getName’ and ‘name’ method derivation mapping with the following information:

[0684] name: get<source_attribute_name/>

[0685] return type: <source_attribute_type/>

[0686] access modifier: public

[0687] body: return name;

[0688] A method template that iterates over source attributes for the ‘setCustomerNumber’ and ‘customerNumber’ method derivation mapping with the following information:

[0689] name: set<source_attribute_name/>

[0690] return type: void

[0691] access modifier: public

[0692] parameters: <source_attribute_type/>a<source_attribute_name/>

[0693] body: this.customerNumber=aCustomerNumber;

[0694] A method template that iterates over source attributes for the ‘setHomePhone’ and ‘homePhone’ method derivation mapping with the following information:

[0695] name: set<source_attribute_name/>

[0696] return type: void

[0697] access modifier: public

[0698] parameters: <source_attribute_type/>a<source_attribute_name/>

[0699] body: this.homePhone=aHomePhone;

[0700] A method template that iterates over source attributes for the ‘setName’ and ‘name’ method derivation mapping with the following information:

[0701] name: set<source_attribute_name/>

[0702] return type: void

[0703] access modifier: public

[0704] parameters: <source_attribute_type/>a<source_attribute_name/>

[0705] body: this.name=aName;

[0706] A method template that iterates over source classes for the ‘create’ and ‘null’ method derivation mapping with the following information:

[0707] name: create

[0708] return type: EJBObject

[0709] access modifier: public.

[0710] After duplicate templates are removed (line 2189), there remain twelve methods that iterate over classes and twenty two method templates that iterate over source attributes. FIG. 82 comprises FIG. 82A and FIG. 82B and is pseudo-code for the algorithm createMethodTemplates; FIG. 83 is pseudo-code for the algorithm expressMethodNameAsContextVariables; FIG. 84 is pseudo-code for the algorithm expressReturnTypeAsContextVariables; FIG. 85 is pseudo-code for the algorithm expressParametersAsContextVariables.

[0711] Finally, the algorithm of the last sub-step (1910) is illustrated below. It serves to replace in the body of method templates all concrete instances with context variables. The method templates created by the preceding step (1905) for the Bank system will be (other templates remain unchanged):

[0712] The method template that iterates over source attributes for the ‘getAccountNumber’and ‘accountNumber’ method derivation mapping with the following information:

[0713] name: get<source_attribute_name/>

[0714] return type: <source_attribute_type/>

[0715] access modifier: public

[0716] body: return <source_attribute_name/>;

[0717] The method template that iterates over source attributes for the ‘getBalance’ and ‘balance’ method derivation mapping with the following information:

[0718] name: get<source_attribute_name/>

[0719] return type: <source_attribute_type/>

[0720] access modifier: public

[0721] body: return <source_attribute_name/>;

[0722] The method template that iterates over source attributes for the ‘getOpenDate’ and ‘openDate’ method derivation mapping with the following information:

[0723] name: get<source_attribute_name/>

[0724] return type: <source_attribute_type/>

[0725] access modifier: public

[0726] body: return <source_attribute_name/>;

[0727] The method template that iterates over source attributes for the ‘getCustomer’ and ‘customer’ method derivation mapping with the following information:

[0728] name: get<source_attribute_name/>

[0729] return type: <source_attribute_type/>

[0730] access modifier: public

[0731] body: return <source_attribute_name/>;

[0732] The method template that iterates over source attributes for the ‘setAccountNumber’ and ‘accountNumber’ method derivation mapping with the following information:

[0733] name: set<source_attribute_name/>

[0734] return type: void

[0735] access modifier: public

[0736] parameters: <source_attribute_type/>a<source_attribute_name/>

[0737] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0738] The method template that iterates over source attributes for the ‘setBalance’ and ‘balance’ method derivation mapping with the following information:

[0739] name: set<source_attribute_name/>

[0740] return type: void

[0741] access modifier: public

[0742] parameters: <source_attribute_type/>a<source_attribute_name/>

[0743] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0744] The method template that iterates over source attributes for the ‘setOpenDate’ and ‘openDate’ method derivation mapping with the following information:

[0745] name: set<source_attribute_name/>

[0746] return type: void

[0747] access modifier: public

[0748] parameters: <source_attribute_type/>a<source_attribute_name/>

[0749] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0750] The method template that iterates over source attributes for the ‘setCustomer’ and ‘customer’ method derivation mapping with the following information:

[0751] name: set<source_attribute_name/>

[0752] return type: void

[0753] access modifier: public

[0754] parameters: <source_attribute_type/>a<source_attribute_name/>

[0755] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0756] The method template that iterates over source attributes for the ‘getAmount’ and ‘amount’ method derivation mapping with the following information:

[0757] name: get<source_attribute_name/>

[0758] return type: <source_attribute_type/>

[0759] access modifier: public

[0760] body: return <source_attribute_name/>;

[0761] The method template that iterates over source attributes for the ‘getDateTime’ and ‘dateTime’ method derivation mapping with the following information:

[0762] name: get<source_attribute_name/>

[0763] return type: <source_attribute_type/>

[0764] access modifier: public

[0765] body: return <source_attribute_name/>;

[0766] The method template that iterates over source attributes for the ‘getTransactionNumber’ and ‘transactionNumber’ method derivation mapping with the following information:

[0767] name: get<source_attribute_name/>

[0768] return type: <source_attribute_type/>

[0769] access modifier: public

[0770] body: return <source_attribute_name/>;

[0771] The method template that iterates over source attributes for the ‘getAccount’ and ‘account’ method derivation mapping with the following information:

[0772] name: get<source_attribute_name/>

[0773] return type: <source_attribute_type/>

[0774] access modifier: public

[0775] body: return <source_attribute_name/>;

[0776] The method template that iterates over source attributes for the ‘setAmount’ and ‘amount’ method derivation mapping with the following information:

[0777] name: set<source_attribute_name/>

[0778] return type: void

[0779] access modifier: public

[0780] parameters: <source_attribute_type/>a<source_attribute_name/>

[0781] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0782] The method template that iterates over source attributes for the ‘setDateTime’ and ‘dateTime’ method derivation mapping with the following information:

[0783] name: set<source_attribute_name/>

[0784] return type: void

[0785] access modifier: public

[0786] parameters: <source_attribute_type/>a<source_attribute_name/>

[0787] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0788] The method template that iterates over source attributes for the ‘setTransactionNumber’ and ‘transactionNumber’ method derivation mapping with the following information:

[0789] name: set<source_attribute_name/>

[0790] return type: void

[0791] access modifier: public

[0792] parameters: <source_attribute_type/>a<source_attribute_name/>

[0793] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0794] The method template that iterates over source attributes for the ‘setAccount’ and account’ method derivation mapping with the following information:

[0795] name: set<source_attribute_name/>

[0796] return type: void

[0797] access modifier: public

[0798] parameters: <source_attribute_type/>a<source_attribute_name/>

[0799] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0800] The method template that iterates over source attributes for the ‘getCustomerNumber’ and ‘customerNumber’ method derivation mapping with the following information:

[0801] name: get<source_attribute_name/>

[0802] return type: <source_attribute_type/>

[0803] access modifier: public

[0804] body: return <source_attribute_name/>;

[0805] The method template that iterates over source attributes for the ‘getHomePhone’ and ‘homePhone’ method derivation mapping with the following information:

[0806] name: get<source_attribute_name/>

[0807] return type: <source_attribute_type/>

[0808] access modifier: public

[0809] body: return <source_attribute_name/>;

[0810] The method template that iterates over source attributes for the ‘getName’ and ‘name’ method derivation mapping with the following information:

[0811] name: get<source_attribute_name/>

[0812] return type: <source_attribute_type/>

[0813] access modifier: public

[0814] body: return <source_attribute_name/>;

[0815] The method template that iterates over source attributes for the ‘setCustomerNumber’ and ‘customerNumber’ method derivation mapping with the following information:

[0816] name: set<source_attribute_name/>

[0817] return type: void

[0818] access modifier: public

[0819] parameters: <source_attribute_type/>a<source_attribute_name/>

[0820] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0821] The method template that iterates over source attributes for the ‘setHomePhone’ and ‘homePhone’ method derivation mapping with the following information:

[0822] name: set<source_attribute_name/>

[0823] return type: void

[0824] access modifier: public

[0825] parameters: <source_attribute_type/>a<source_attribute_name/>

[0826] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0827] The method template that iterates over source attributes for the ‘setName’ and ‘name’ method derivation mapping with the following information:

[0828] name: set<source_attribute_name/>

[0829] return type: void

[0830] access modifier: public

[0831] parameters: <source_attribute_type/>a<source_attribute_name/>

[0832] body: this.<source_attribute_name/>=a<source_attribute_name/>;

[0833] After duplicate templates are removed (line 2389), there remain twelve methods that iterate over classes and only two method templates that iterate over source attributes. FIG. 86 is pseudo-code for the algorithm abstractBodyOfMethodTemplates, and FIG. 87 is pseudo-code for the algorithm replaceConcreteInstancesWithContextVariables.

[0834] Scenario 3

[0835] This scenario is a mix of the first two scenarios. Let sourceCode1 be component-based source code, businessLogic1 be the abstract representation of its business logic, and projGen a set of generation templates used to generate sourceCode1 from businessLogic1 [refer to patent]. Assuming that sourceCode1 has evolved to sourceCode2, to ensure the consistency between the source code and its abstract representation, the reverse-engineering engine in this scenario follows the process described in FIG. 20. This process consists of five steps: parse sourceCode1, parse sourceCode2, report Δ code, update businessLogic1, and update projGen.

[0836] The parsing steps (2000 and 2005) consist of getting the meta-data of the source code including packages, classes, class and component attributes, and class and component methods. These steps are the same as the steps (200) and (205).

[0837] The step ‘report Δ code’ (2010), as in (210), provides the following information:

[0838] What are the classes of sourceCode2 that do not exist in sourceCode1 ?

[0839] What are the classes of sourceCode1 that do not exist anymore in sourceCode2?

[0840] What are the classes of sourceCode1 that are changed in sourceCode2?

[0841] For each changed class of sourceCode2,

[0842] What are the new attributes?

[0843] What are the suppressed attributes?

[0844] What are the updated attributes?

[0845] What are the new methods?

[0846] What are the suppressed methods?

[0847] What are the updated methods?

[0848] What are the new associations?

[0849] What are the suppressed associations?

[0850] What are the updated associations?

[0851] The step ‘update businessLogic1’ (2015) consists of updating the business logic of the component source code with the information reported by the preceding step and filtered with the generation templates contained in projGen. This step is different from step (215). In fact, in this scenario, updating the business logic is a process that comprises three sub-steps (see FIG. 21): update business classes, update attributes of business classes, and update methods of business classes.

[0852] The algorithm for updating business classes (2100) is presented below. The algorithm starts by removing business classes that no longer exist (lines 24340-2441). Then it removes architectural layers and their corresponding generation templates that no longer exist in the evolved source code (lines 2443-2453). Finally, the algorithm looks for new candidate business classes from the new classes reported by the last step (2010). Extracting new candidate business classes follows the same process as in (1500).

[0853] See FIG. 88, which is pseudo-code for the algorithm updateBusinessClasses (2100).

[0854] The algorithm for updating attributes of business classes (2105) is presented below. The algorithm starts by removing attributes of business classes that no longer exist (lines 2487-2491). Then the algorithm looks for the attributes of new candidate business classes from the new classes reported by the last step (2010). Extracting attributes of new candidate business classes follows the same process as in (1505).

[0855] See FIG. 89, which is pseudo-code for the algorithm updateAttributesForBusinessClasses (2105).

[0856] The algorithm for updating methods of business classes (2110) is presented below. The algorithm starts by removing methods of business classes that no longer exist (lines 2538-2542). Then the algorithm looks for the methods of new candidate business classes from the new classes reported by the last step (2010). Extracting methods of new candidate business classes follows the same process as in (1510).

[0857] See FIG. 90, which is pseudo-code for the algorithm updateMethodsForBusinessClasses (2110).

[0858] The step ‘update projGen’ (2020) consists of three sub-steps (see FIG. 22): update class and interface templates, update attribute templates, update method templates.

[0859] The step ‘update class and interface templates’ (2200) follows the same process as the step (1410), except that (2200) works only on new classes reported by step (2010).

[0860] The step ‘update attribute templates’ (2205) follows the same process as step (1415), except that (2205) works only on new classes reported by step (2010).

[0861] The step ‘update attribute templates’ (2210) follows the same process as step (1420), except that (2210) works only on new classes reported by step (2010).

[0862] While the invention has been described with particular reference to the illustrated embodiment, it will be understood that numerous modifications thereto will appear to those skilled in the art. Accordingly, the above description and accompanying drawings should be taken as illustrative of the invention and not in a limiting sense. 

What is claimed is:
 1. A method of generating a higher-level representation of program source code, the method comprising: providing a program source code; parsing said program source code to obtain meta-data corresponding to said program source code; determining a business logic from at least said meta-data; translating said program source code into parameterized source code using at least one of said business logic and said meta-data; extracting infrastructure code from said parameterized source code using at least one of said source code and said meta-data; building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit generation of said program source code using said higher-level representation.
 2. A method as claimed in claim 1, wherein said providing comprises retrieving a file containing said program source code.
 3. A method as claimed in claim 1, wherein said meta-data are structural properties and are at least one of a package, a class name, a class attribute, a component attribute, a class method, an attribute type, a method signature, a visibility, a body and a component method.
 4. A method as claimed in claim 1, wherein said parsing comprises creating a new class and obtaining a meta-data for said new class, and said determining comprises adding said meta-data for said new class to said business logic.
 5. A method as claimed in claim 1, further comprising providing an indication of said higher-level representation of said source code.
 6. A method as claimed in claim 1, further comprising editing said higher-level representation.
 7. A method as claimed in claim 5, further comprising editing said indication of said higher-level representation.
 8. A method as claimed in claim 1, wherein said higher-level representation comprises a UML model represented as a class diagram with specification data.
 9. A method as claimed in claim 1, wherein said higher-level representation comprises at least one generation template having template data.
 10. A method of program code reengineering comprising: providing a program source code; parsing said program source code to obtain meta-data corresponding to said program source code; determining a business logic from at least said meta-data; translating said program source code into parameterized source code using at least one of said business logic and said meta-data; extracting infrastructure code from said parameterized source code using at least one of said source code and said meta-data; building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit generation of said program source code using said higher-level representation; modifying at least a portion of said higher-level representation to effect a reengineering change in said program source code; and generating reengineered program source code using said modified higher-level representation.
 11. A method as claimed in claim 10, wherein said providing comprises retrieving a file containing said program source code.
 12. A method as claimed in claim 10, wherein said modifying comprises changing a class name.
 13. A method as claimed in claim 10, wherein said modifying comprises changing an attribute of a component.
 14. A method as claimed in claim 10, wherein said modifying comprises editing template data obtained from said higher-level representation.
 15. A method as claimed in claim 10, wherein said generating comprises creating a reengineered program source code different from said program source code, said reengineered program source code having modifications according to said modified higher-level representation.
 16. A method of generating a higher-level representation of program source code using a set of previously used generation template data, the method comprising: providing a program source code; providing a set of generation template data previously used to generate said program source code; selecting at least one of said set of generation template data; parsing said program source code to obtain meta-data corresponding to said program source code; determining a business logic from at least said meta-data; translating said program source code into parameterized source code using said set of generation template data and at least one of said business logic and said meta-data; extracting infrastructure code from said parameterized source code using said set of generation template data and at least one of said source code and said meta-data; building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit generation of said program source code using said higher-level representation.
 17. A method as claimed in claim 16, further comprising providing an indication of said higher-level representation of said source code and an indication of associated generation template data corresponding to at least a portion of said source code.
 18. A method as claimed in claim 16, further comprising providing means to enable portion of the source code corresponding to specific generation template data to be reflected in the higher-level representation if the generation template data is not acting as a filter by unselecting its associated means.
 19. An apparatus for generating a higher-level representation of program source code comprising: a program source code provider for providing a program source code; a parser for parsing said program source code to obtain meta-data corresponding to said program source code; a business logic determiner for determining a business logic from at least said meta-data; a code translator for translating said program source code into parameterized source code using at least one of said business logic and said meta-data; an infrastructure extractor for extracting infrastructure code from said parameterized source code using at least one of said source code and said meta-data; an abstraction builder for building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit to a code generator to generate said program source code using said higher-level representation.
 20. An apparatus as claimed in claim 19, wherein said program source code provider receives a signal containing said program source code.
 21. An apparatus as claimed in claim 19, further comprising a display for providing an indication of said higher-level representation of said source code.
 22. An apparatus as claimed in claim 21, further comprising an editor for editing said higher-level representation.
 23. An apparatus as claimed in claim 19, further comprising a transmitter for transmitting a signal comprising said higher-level representation.
 24. An apparatus for reengineering program code comprising: a program source code provider for providing a program source code; a parser for parsing said program source code to obtain meta-data corresponding to said program source code; a business logic determiner for determining a business logic from at least said meta-data; a code translator for translating said program source code into parameterized source code using at least one of said business logic and said meta-data; an infrastructure extractor for extracting infrastructure code from said parameterized source code using at least one of said source code and said meta-data; an abstraction builder for building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit to a code generator to generate said program source code using said higher-level representation; a reengineering modifier for modifying at least a portion of said higher-level representation to effect a reengineering change in said program source code; and a code generator for generating reengineered program source code using said modified higher-level representation.
 25. An apparatus as claimed in claim 24, wherein said provider retrieves a file containing said program source code.
 26. An apparatus as claimed in claim 24, further comprising an abstraction transmitter for transmitting a signal comprising said higher-level representation.
 27. An apparatus as claimed in claim 24, further comprising a reengineered code transmitter for transmitting a signal comprising said reengineered program source code.
 28. An apparatus for generating a higher-level representation of program source code using a set of previously used generation template data, the apparatus comprising: a program source code provider for providing a program source code; template provider for providing a set of generation template data previously used to generate said program source code; template selector for selecting at least one of said set of generation template data; a parser for parsing said program source code to obtain meta-data corresponding to said program source code; a business logic determiner for determining a business logic from at least said meta-data; a code translator for translating said program source code into parameterized source code using said set of generation template data and at least one of said business logic and said meta-data; an infrastructure extractor for extracting infrastructure code from said parameterized source code using said set of generation template data and at least one of said source code and said meta-data; an abstraction builder for building the higher-level representation of said source code using said business logic and said infrastructure code, wherein said higher-level representation provides sufficient information about said source code to permit to a code generator to generate said program source code using said higher-level representation.
 29. An apparatus as claimed in claim 28, further comprising a display for providing an indication of said higher-level representation of said source code and an indication of associated generation template data corresponding to at least a portion of said source code.
 30. An apparatus as claimed in claim 28, further comprising means to enable portion of the source code corresponding to specific generation template data to be reflected in the higher-level representation if the generation template data is not acting as a filter by unselecting its associated means.
 31. A computer program comprising code means adapted to perform all steps of any one of claims 1 to 18, embodied on a computer readable medium.
 32. A computer program comprising code means adapted to perform all steps of any one of claims 1 to 18, embodied as an electrical or electro-magnetical signal.
 33. A computer data signal embodied in a carrier wave comprising said higher-level representation built according to any one of claims 1 to
 30. 34. A computer program comprising code means adapted to make, once loaded into a computer, the apparatus of any one of claims 19 to 30, embodied on a computer readable medium.
 35. A computer program comprising code means adapted to make, once loaded into a computer, the apparatus of any one of claims 19 to 30, embodied as an electrical or electro-magnetical signal. 